import request from '@/axios'

export const getRoleListApi = (data) => {
  return request.post({ url: '/api/Role/GetRoles', data })
}
export const searchRoleApi = (params) => {
  return request.get({ url: '/api/Role/SearchRoleMenus', params })
}
export const downloadDeviceTemplateApi = () => {
  return request.post({ url: '/api/Device/DownloadDeviceTemplate', responseType: 'blob' })
}

/**
 * 查询角色菜单和按钮权限
 * @param params
 * @returns
 */
export const SearchRoleMenuAndButtonsApi = (params) => {
  return request.get({ url: '/api/Role/SearchRoleMenuAndButtons', params })
}

/**
 * 添加角色菜单按钮
 * @param data
 * @returns
 */
export const AddRoleMenuButtonsApi = (data) => {
  return request.post({ url: '/api/Role/AddRoleMenuButtons', data })
}
export const GetRoleMenuButtonsApi = (params) => {
  return request.get({ url: '/api/Menu/GetRoleMenuButtons', params })
}

export const downloadStationTemplateApi = () => {
  return request.post({
    url: '/api/CollectionStation/DownloadStationTemplate',
    responseType: 'blob'
  })
}
export const addRoleApi = (data) => {
  return request.post({ url: '/api/Role/AddRole', data })
}
export const delRoleApi = (data) => {
  return request.post({ url: '/api/Role/DeleteRoles', data })
}
export const updateRoleApi = (data) => {
  return request.post({ url: '/api/Role/UpdateRole', data })
}

export const getLogsApi = (data) => {
  return request.post({ url: '/api/Log/getLogs', data })
}

export const getSystemStatusApi = (data) => {
  return request.post({ url: '/api/StationStatus/GetStationStatus', data })
}

export const getVersionApi = (params: any) => {
  return request.get({ url: '/api/Version/GetClientVersion', params })
}

/**
 * 查询采集站信息
 * @param data
 * @returns
 */
export const getStationsApi = (data) => {
  return request.post({ url: '/api/CollectionStation/GetStations', data })
}
/**
 * 添加采集站信息
 * @param data
 * @returns
 */
export const addStationApi = (data) => {
  return request.post({ url: '/api/CollectionStation/AddStation', data })
}
/**
 * 删除采集站信息
 * @param data
 * @returns
 */
export const deleteStationsApi = (data) => {
  return request.post({ url: '/api/CollectionStation/DeleteStations', data })
}

/**
 * 编辑采集站信息
 * @param data
 * @returns
 */
export const updateStationApi = (data) => {
  return request.post({ url: '/api/CollectionStation/UpdateStation', data })
}

/**
 * 查询设备管理
 * @param data
 * @returns
 */
export const getDevicesApi = (data) => {
  return request.post({ url: '/api/Device/GetDevices', data })
}
/**
 * 添加设备管理
 * @param data
 * @returns
 */
export const addDeviceApi = (data) => {
  return request.post({ url: '/api/Device/AddDevice', data })
}
/**
 * 删除设备管理
 * @param data
 * @returns
 */
export const deleteDeviceApi = (data) => {
  return request.post({ url: '/api/Device/DeleteDevices', data })
}

/**
 * 编辑设备管理
 * @param data
 * @returns
 */
export const updateDeviceApi = (data) => {
  return request.post({ url: '/api/Device/UpdateDevice', data })
}

/**
 * 查询公告列表
 * @param data
 * @returns
 */
export const getNoticesApi = (data) => {
  return request.post({ url: '/api/Notice/GetNotices', data })
}
export const addNoticeApi = (data) => {
  return request.post({ url: '/api/Notice/AddNotice', data })
}

export const updateNoticeApi = (data) => {
  return request.post({ url: '/api/Notice/UpdateNotice', data })
}

export const deleteNoticesApi = (data) => {
  return request.post({ url: '/api/Notice/DeleteNotices', data })
}

export const getAllNoticesApi = (data) => {
  return request.post({ url: '/api/Notice/GetAllNotices', data })
}

export const getProblemTypesApi = (params) => {
  return request.get({ url: '/api/ProbleType/GetProblemTypes', params })
}
export const addProblemTypesApi = (data) => {
  return request.post({ url: '/api/ProbleType/AddProblemType', data })
}
export const updateProblemTypesApi = (data) => {
  return request.post({ url: '/api/ProbleType/UpdateProblemType', data })
}
export const deleteProblemTypesApi = (data) => {
  return request.post({ url: '/api/ProbleType/DeleteProblemTypes', data })
}

export const getLogLevelsApi = () => {
  // return request.get({ url: '/mock/role/table' })
  return request.get({ url: '/api/Config/GetLogLevels' })
}
export const getDeviceStatusApi = () => {
  return request.get({ url: '/api/Config/GetDeviceStatus' })
}

export const getSoftTypesApi = () => {
  return request.get({ url: '/api/Config/GetSoftTypes' })
}
export const AddClientVersionApi = (data) => {
  return request.post({ url: '/api/Version/AddClientVersion', data })
}

export const GetVersionsApi = (data) => {
  return request.post({ url: '/api/Version/GetVersions', data })
}

export const GetVersionStatusApi = (data) => {
  return request.post({ url: '/api/Version/GetVersionStatus', data })
}

export const delUpgradePackageApi = (params) => {
  return request.get({ url: '/api/Version/DeleteClientVersion', params })
}

export const AddWorkTypeApi = (data) => {
  return request.post({ url: '/api/WorkType/AddWorkType', data })
}

export const DeleteWorkTypesApi = (data) => {
  return request.post({ url: '/api/WorkType/DeleteWorkTypes', data })
}

export const EditWorkTypeApi = (data) => {
  return request.post({ url: '/api/WorkType/EditWorkType', data })
}

export const GetWorkTypesApi = (data) => {
  return request.post({ url: '/api/WorkType/GetWorkTypes', data })
}
